<!-- 头部 start -->
<header id="header">
    <script src="js/getParameter.js"></script>
    <script>
        $(function () {
            //查询用户信息
            $.get("user/findOne", {}, function (data) {
                let msg = "欢迎回来，" + data.name;
                $("#span_username").html(msg);
                // alert(data.name)
            })
            //查询分类数据
            $.get("category/findAll", {}, function (data) {
                //首页
                // <!--<li class="nav-active"><a href="index.html">首页</a></li>-->
                let lis = "<li class=\"nav-active\"><a href=\"index.html\">首页</a></li>";
                for (let i = 0; i < data.length; i++) {
                    let li = '<li><a href="route_list.html?cid='+data[i].cid+'">'+data[i].cname+'</a></li>';
                    lis += li;
                }
                lis += "<li><a href=\"favoriterank.html\">收藏排行榜</a></li>";
                $("#category").html(lis)
            })
            //给搜索按钮绑定单击事件,获取搜索输入框内容
            $("#search_button").click(function () {
                //搜索的值
                let rname = $("#search_input").val();
                //alert(rname)
                //跳转路径
                let cid = getParameter("cid");
                //alert(cid)
               location.href="http://localhost/travel/route_list.html?cid="+cid+"&rname="+rname;

            })


        })
    </script>
    <div class="top_banner">
        <img src="images/top_banner.jpg" alt="">
    </div>
    <div class="shortcut">
        <!-- 未登录状态  -->
        <div class="login_out">
            <a href="login.html">登录</a>
            <a href="register.html">注册</a>
        </div>
        <!-- 登录状态  -->
        <div class="login">

            <span id="span_username"></span>
            <a href="myfavorite.html" class="collection">我的收藏</a>
            <a href="javascript:location.href='user/exit';">退出</a>
        </div>
    </div>
    <div class="header_wrap">
        <div class="topbar">
            <div class="logo">
                <a href="/"><img src="images/logo.jpg" alt=""></a>
            </div>
            <div class="search">
                <input name="" type="text" placeholder="请输入路线名称" class="search_input" autocomplete="off" id="search_input">
                <a href="javascript:;" class="search-button" id="search_button">搜索</a>
            </div>
            <div class="hottel">
                <div class="hot_pic">
                    <img src="images/hot_tel.jpg" alt="">
                </div>
                <div class="hot_tel">
                    <p class="hot_time">客服热线(9:00-6:00)</p>
                    <p class="hot_num">400-618-9090</p>
                </div>
            </div>
        </div>
    </div>
</header>
<!-- 头部 end -->
<!-- 首页导航 -->
<div class="navitem">
    <ul class="nav" id="category">
        <!--        <li class="nav-active"><a href="index.html">首页</a></li>-->
        <!--        <li><a href="route_list.html">门票</a></li>-->
        <!--        <li><a href="route_list.html">酒店</a></li>-->
        <!--        <li><a href="route_list.html">香港车票</a></li>-->
        <!--        <li><a href="route_list.html">出境游</a></li>-->
        <!--        <li><a href="route_list.html">国内游</a></li>-->
        <!--        <li><a href="route_list.html">港澳游</a></li>-->
        <!--        <li><a href="route_list.html">抱团定制</a></li>-->
        <!--        <li><a href="route_list.html">全球自由行</a></li>-->
        <!--        <li><a href="favoriterank.html">收藏排行榜</a></li>-->
    </ul>
</div>
    